package com.stu.demo0519.demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-05-20
 * Time: 10:52
 */
//父类
public class Animal {
    public String name;
    public int age;
    //成员方法 -> 构造方法
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    //普通成员方法
    public void eat() {
        System.out.println(this.name + " 正在吃饭..........");
    }
    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
